[[http://www.gnu.org/licenses/gpl-3.0.txt][file:https://img.shields.io/badge/license-GPL_3-orange.svg]]
[[http://melpa.org/#/shift-number][file:http://melpa.org/packages/shift-number-badge.svg]]
[[http://stable.melpa.org/#/shift-number][file:http://stable.melpa.org/packages/shift-number-badge.svg]]

** About

This Emacs package provides commands to increase and decrease the number
at point (or the next number on the current line).

[[file:demo.gif]]

** Installation

*** Automatic

This package can be installed from [[http://melpa.org/][MELPA]] (with =M-x package-install= or
=M-x list-packages=).

*** Manual

For the manual installation, clone the repo, add the directory to
=load-path= and add autoloads for the interactive commands:

#+BEGIN_SRC emacs-lisp
(add-to-list 'load-path "/path/to/shift-number-dir")
(autoload 'shift-number-up "shift-number" nil t)
(autoload 'shift-number-down "shift-number" nil t)
#+END_SRC

** Usage

As you can see in the gif demonstration:

- =M-x shift-number-up= increases the current number.  If there is no
  number at point, the first number between the current position and the
  end of line is increased.  With a numeric prefix ARG, the number is
  increased for this ARG.

- =M-x shift-number-down= decreases the current number.

You may bind some keys to these commands in a usual manner, for example:

#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "M-+") 'shift-number-up)
(global-set-key (kbd "M-_") 'shift-number-down)
#+END_SRC

** Similar packages

There are other packages for the same task (modifying the number at
point):

- [[https://github.com/knu/operate-on-number.el][operate-on-number]]
- [[https://github.com/chrisdone/number][number]]
- [[https://github.com/cofi/evil-numbers][evil-numbers]]

Comparing with them, =shift-number= has the following distinctions:

- If there is no number at point, it operates on the next number on the
  current line.

- The point does not move anywhere when a number is modified.

- If a number has leading zeros (for example =007=), they are preserved
  during shifting.

- It is simple: only shifting up/down is available, no multiplication or
  other more complex stuff.

- It does not prompt for any additional input: you just press a key
  bound to =shift-number-{up/down}= command and the number is changing.
